home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Macintosh Drag and Drop / Demo Applications / Dragster / DragText Sources / windows.c < prev   
Encoding:
C/C++ Source or Header  |  1995-01-03  |  1.2 KB  |  68 lines  |  [TEXT/KAHL]

  1. /*
  2.  *
  3.  *        windows.c
  4.  *
  5.  *        Window handling routines.
  6.  *        
  7.  *
  8.  *        Author:        Rob Johnston
  9.  *        Date:        Monday, January 20, 1992
  10.  *
  11.  *        12/30/94    JML        Code now compiles with Universal interfaces.
  12.  *
  13.  *        Copyright © 1992 Apple Computer, Inc.
  14.  *
  15.  */
  16.  
  17.  
  18. #include <ToolUtils.h>
  19. #include "globals.h"
  20.  
  21.  
  22. /*
  23.  *    UpdateWindow is called when an update event is received for a docuemnt
  24.  *    window.
  25.  */
  26.  
  27. void UpdateWindow(Document *theDocument)
  28.  
  29. {    WindowPtr        theWindow;
  30.  
  31.     theWindow = theDocument->theWindow;
  32.  
  33.     SetPort(theWindow);
  34.     BeginUpdate(theWindow);
  35.  
  36.     EraseRect(&theWindow->portRect);
  37.  
  38.     DrawControls(theWindow);
  39.     DrawGrowIcon(theWindow);
  40.  
  41.     TEUpdate(&theWindow->portRect, theDocument->theTE);
  42.  
  43.     EndUpdate(theWindow);
  44. }
  45.  
  46.  
  47. /*
  48.  *    GrowDocumentWindow is called when the user clicks in the growRgn of a
  49.  *    document window.
  50.  */
  51.  
  52. void GrowDocumentWindow(WindowPtr theWindow, Point thePoint)
  53.  
  54. {    long        result;
  55.     Rect        sizeRect;
  56.  
  57.     SetPort(theWindow);
  58.  
  59.     sizeRect = qd.screenBits.bounds;
  60.     if (!(result = GrowWindow(theWindow, thePoint, &sizeRect)))
  61.         return;
  62.     SizeWindow(theWindow, LoWord(result), HiWord(result), false);
  63.     PositionDocumentParts((Document *) ((WindowPeek) theWindow)->refCon);
  64.     AdjustScrollBar((Document *) ((WindowPeek) theWindow)->refCon);
  65.     InvalRect(&theWindow->portRect);
  66. }
  67.  
  68.